class Solution(object):
    def minimumSwap(self, s1, s2):
        ans1 = 0
        ans2 = 0
        n = len(s1)
        for i in range(n):
            if s1[i] != s2[i]:
                if s1[i] == 'x':
                    ans1 += 1
                else:
                    ans2 += 1
        if ans1 % 2 == 0 and ans2 % 2 == 0:
            return ans1 // 2 + ans2 // 2
        else:
            if ans1 % 2 == 1 and ans2 % 2 == 1:
                return ans1 // 2 + ans2 // 2 + 2
            else:
                return -1